/**
 * Test that the renderBirthday function return a date with this format dd/MM/yyyy
**/
describe("convert(aDate):", function() {
    it("Renders a date in this format dd/MM/yyyy ", function() {
        expect(convert("2003-12-11T00:00:00.0000000").toDDmmYYYY()).toEqual("11/12/2003");
		expect(convert("2008-02-08T00:00:00.0000000").toDDmmYYYY()).toEqual("08/02/2008");
    });
});

/**
 * Test that the renderBirthday function return a date with this format dd/MM/yyyy
**/
describe("toDDmmYYYY(aDate):", function() {
    it("Renders a date in this format dd/MM/yyyy ", function() {
        expect(convert("2003-12-11T00:00:00.0000000").toDDmmYYYY()).toEqual("11/12/2003");
		expect(convert("2008-02-08T00:00:00.0000000").toDDmmYYYY()).toEqual("08/02/2008");
    });
});

/**
 * Test that the renderAction function return an anchor tag
**/
describe("renderAction(animalId):", function() {
    it("return an anchor tag with the supplied animalId ", function() {
        expect(renderAction("100")).toEqual("<a href=\"detail.html?id=100\">Details</a>");
		expect(renderAction("")).toEqual("<a href=\"detail.html?id=\">Details</a>");
    });
});

/**
 * Test that the renderCheckBox function return a checkbox tag
**/
describe("renderCheckBox(hasHorns):", function() {
    it("return a checked checkbox input tag ", function() {
        expect(renderCheckBox(true)).toEqual("<input value = 1 type=\"checkbox\" checked disabled/>");
    });
	it("return an un-checked checkbox input tag ", function() {
        expect(renderCheckBox(false)).toEqual("<input value = 0 type=\"checkbox\" disabled/>");
    });
});

/**
 * Test the valueOf method set the value of an element to the provided value.
**/
describe("setValueOf(element).to(value):", function() {
    it("Set the supplied element value to a value ", function() {
		var element = {
			value : "",
			val: function(aValue){
					this.value = aValue;
				}
		}
		
		setValueOf(element).to("Hello!");
        expect(element.value).toEqual("Hello!");
    });
	
});

/**
 * Test the tickThisCheckbox will tick a checkbox when the supplied condition is true;
**/
describe("when(aCondition).checked(aCheckbox):", function() {
    it("Checked the supplied checkbox when the condition is true ", function() {
		var checkbox = {
			checked : "",
			attr: function(aValue){
					this.checked = aValue;
				  }
		}
		
		when(true).tickThisCheckbox(checkbox);
        expect(checkbox.checked).toEqual("checked");
		
		checkbox.checked = "";
		
		when(false).tickThisCheckbox(checkbox);
		expect(checkbox.checked).toEqual("");
    });
	
});

